package com.example.aigc_education.enums;

import lombok.Getter;

@Getter
public enum TodoType {
    //            "todoType": "enum('important-urgent', 'important-not-urgent', 'urgent-not-important', 'not-important-not-urgent'), required, 四象限分类",
    IMPORTANT_URGENT("重要且紧急",0),
    IMPORTANT_NOT_URGENT("重要且不紧急",1),
    URGENT_NOT_IMPORTANT("紧急且不重要",2),
    NOT_IMPORTANT_NOT_URGENT("不重要且不紧急",3);
    private final String title;
    private final Integer value;
    TodoType(String title, Integer value) {
        this.title = title;
        this.value = value;
    }
    public static TodoType fromValue(Integer value) {
        for (TodoType todoType : TodoType.values()) {
            if (todoType.value.equals(value)) {
                return todoType;
            }
        }
        throw new IllegalArgumentException("无效的类型值: " + value);
    }
    public static TodoType fromTitle(String title) {
        for (TodoType todoType : TodoType.values()) {
            if (todoType.title.equals(title)) {
                return todoType;
            }
        }
        throw new IllegalArgumentException("无效的todo类型: " + title);
    }
}
